//
//  TreatmentModalityController.m
//  KYProject
//
//  Created by Roman on 16/12/23.
//  Copyright © 2016年 Roman. All rights reserved.
//

#import "TreatmentModalityController.h"

@interface TreatmentModalityController ()<UITableViewDelegate,UITableViewDataSource>

@end
static NSString *cellId = @"LW";
@implementation TreatmentModalityController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationItem.title = @"治疗方法";
    
    //创建tableVIew
    UITableView *tableView = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStylePlain];
    
    [self.view addSubview:tableView];
    
    tableView.delegate = self;
    tableView.dataSource = self;
    tableView.rowHeight = 50;
    //设置分割线
    tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
    //注册
    [tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:cellId ];
    
}

#pragma mark
#pragma mark - 实现代理方法

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 3;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId forIndexPath:indexPath];
    NSArray *array = @[@"手术治疗",@"保守治疗",@"药物治疗"];
    
    cell.textLabel.text = array[indexPath.row];
    
    return cell;

}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    
    //通知传值
    [[NSNotificationCenter defaultCenter] postNotificationName:@"Treatment" object:cell userInfo:nil];
    
    [self.navigationController popViewControllerAnimated:YES];
    
}

-(void)dealloc{
    [[NSNotificationCenter defaultCenter]removeObserver:self];
    NSLog(@"Treatment释放");
}
@end
